package com.job.client.posts.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.job.client.common.result.ResponseResult;
import com.job.client.model.posts.constant.PageConstant;
import com.job.client.model.posts.pojo.PostsCard;
import com.job.client.posts.mapper.PostsCardMapper;
import com.job.client.posts.service.PostsCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 创建职位卡片表 服务实现类
 * </p>
 *
 * @author fkl
 * @since 2023-12-16
 */
@Service
public class PostsCardServiceImpl extends ServiceImpl<PostsCardMapper, PostsCard> implements PostsCardService {
    @Autowired
    private PostsCardMapper postsCardMapper;

    @Override
    public ResponseResult getCardInfo(Integer page,Integer size) {
        if(page == null){
            page = PageConstant.PAGE;
        }
        if(size == null){
            size = PageConstant.SIZE;
        }
        Page<PostsCard> data = new Page<>(page,size);
        QueryWrapper<PostsCard> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("browse");
        postsCardMapper.selectPage(data,queryWrapper);
        return ResponseResult.OkResult(data);
    }
}
